import React from 'react';
import {Button, Toast} from 'antd-mobile';
import {fetch} from '@utils/Fetch';

class Center extends React.Component {
  fLogout = () => {
    const {history} = this.props;
    fetch('/api/user/logout').get()
      .success(res => {
        res.message && Toast.success(res.message, 1);
        history.replace('/login');
      });
  };

  render() {
    return (
      <div className='full-content'>
        <Button type='warning'
                style={{position: 'absolute', bottom: 25, width: '100%'}}
                onClick={this.fLogout}>登出</Button>
      </div>
    )
  }
}

export default Center;
